import request from "@/utils/request";

/**
 * 获取广告列表 分页
 */
export function getGoodsList(params) {
  return request({
    url: "/goods/info/page/list",
    method: "post",
    data: params
  });
}

/**
 * 获取广告明细
 */
export function getGoodsInfo(params) {
  return request({
    url: `/goods/info/info/${params.id}`,
    method: "get",
    data: {}
  });
}

/**
 * 新增广告
 */
export function addGoodsInfo(params) {
  return request({
    url: `/goods/info/add`,
    method: "post",
    data: params
  });
}

/**
 * 编辑广告
 */
export function updateGoodsInfo(params) {
  return request({
    url: `/goods/info/update`,
    method: "post",
    data: params
  });
}

/**
 * 删除广告
 */
export function deleteGoodsInfo(params) {
  return request({
    url: `/goods/info/delete/${params.id}`,
    method: "get"
  });
}

/**
 * 更新广告库存
 */
export function updateGoodsStock(data) {
  return request({
    url: `/goods/info/update/stock`,
    method: "post",
    data
  });
}

/**
 * 广告上架
 */
export function upGoodsInfo(params) {
  return request({
    url: `/goods/info/up/${params.id}`,
    method: "get",
    data: {}
  });
}

/**
 * 广告下架
 */
export function downGoodsInfo(params) {
  return request({
    url: `/goods/info/down/${params.id}`,
    method: "get",
    data: {}
  });
}

/**
 * 获取广告列表 所有
 */
export function getAllGoodsList(params) {
  return request({
    url: "/goods/info/list",
    method: "get",
    params
  });
}

/**
 * 设置默认广告
 */
export function setDefaultGoods(params) {
  return request({
    url: `/goods/info/default/${params.id}`,
    method: "get"
  });
}

/**
 *  查询所有分类
 */
export function getGoodsClassifyList(params) {
  return request({
    url: `/goods/classify/list`,
    method: "get"
  });
}

/**
 * 添加广告分类
 */
export function addGoodsClassify(params) {
  return request({
    url: `/goods/classify/add`,
    method: "post",
    data: params
  });
}

/**
 * 编辑广告分类
 */
export function updateGoodsClassify(params) {
  return request({
    url: `/goods/classify/update`,
    method: "post",
    data: params
  });
}

/**
 * 删除广告分类
 */
export function deleteGoodsClassify(params) {
  return request({
    url: `/goods/classify/delete/${params.id}`,
    method: "get"
  });
}

/**
 * 分类上架
 */
export function upClassifyInfo(params) {
  return request({
    url: `/goods/classify/up/${params.id}`,
    method: "get",
    data: {}
  });
}

/**
 * 分类下架
 */
export function downClassifyInfo(params) {
  return request({
    url: `/goods/classify/down/${params.id}`,
    method: "get",
    data: {}
  });
}

/**
 * 广告默认
 */
export function DefaultGoodsClassify(params) {
  return request({
    url: `/goods/classify/goods/default`,
    method: "get",
    params
  });
}
